//
// Created by mabinjie on 2024/10/28.
//

#ifndef SERVER_TIME_RES_HPP
#define SERVER_TIME_RES_HPP
#include "common/types.h"
#include "protocol/message/jtt808_body.hpp"

namespace protocol::platform {

class ServerTimeRes final : public jtt808_body {
public:
    common::BcdTime server_time_;

    IMPLEMENT_SIZEABLE(server_time_)
    IMPLEMENT_TOSTRING(message_id_, server_time_)

    ServerTimeRes() : jtt808_body(0x8004) {}
    explicit ServerTimeRes(const common::BcdTime &server_time) : jtt808_body(0x8004), server_time_(server_time) {}

    ServerTimeRes(const ServerTimeRes &other) = default;

    ServerTimeRes(ServerTimeRes &&other) noexcept = default;

    ServerTimeRes & operator=(const ServerTimeRes &other) = default;

    ServerTimeRes & operator=(ServerTimeRes &&other) noexcept = default;

    ~ServerTimeRes() override = default;

    void serialize(common::MessagePackWriter &writer) override {
        server_time_.serialize(writer);
    }

    void deserialize(common::MessagePackReader &reader) override {
        server_time_.deserialize(reader);
    }
};

}

#endif //SERVER_TIME_RES_HPP
